#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;

const int N=100000;

int n,m;
int in[N+10];
int t1,t2,t3;


struct segment_tree
{
    int tot;
	struct node
	{
		int l,r;
		int son[2];
		int data;							
	}a[N<<2]; 
	
	
	void build(int x,int l,int r)
	{
			

		
		a[x].l=l;			
		a[x].r=r;
		if(l==r)
		{
			a[x].data=in[l];
			return;									
		}
		
		
		
		int mid=(l+r)>>1;
		a[x].son[0]=++tot;	
		build(tot,l,mid);
		
		a[x].son[1]=++tot;
		build(tot,mid+1,r);	
		update(x);
		
		
	}
	
	void update(int x)
	{
		a[x].data=min(a[a[x].son[0]].data,a[a[x].son[1]].data);				
	}
	
	void draw()
	{
		for(int i=1;i<=tot;i++)printf("i=%d l=%d r=%d son[0]=%d son[1]=%d data=%d\n",i,a[i].l,a[i].r,a[i].son[0],a[i].son[1],a[i].data);
	}
	
	void change(int x,int id,int c)
	{
		if(a[x].l==a[x].r)
		{
			a[x].data=c;
			return;
		}
		int mid=(a[x].l+a[x].r)>>1;
		if(id<=mid)change(a[x].son[0],id,c);
		else change(a[x].son[1],id,c);
		update(x);
	}
	
	int search(int x,int l,int r)
	{   
		if(a[x].l>=l && a[x].r<=r)
			return a[x].data;
		int re=0x3fffffff;
		int mid=(a[x].l+a[x].r)>>1;
		if(l<=mid)re=min(re,search(a[x].son[0],l,r));
		if(r>mid)re=min(re,search(a[x].son[1],l,r));
		return re;
	}
	
}tree;

int main()
{
	freopen("faithful.in","r",stdin);
	freopen("faithful.out","w",stdout);
scanf("%d%d",&m,&n);
for(int i=1;i<=m;i++)scanf("%d",&in[i]);								

tree.tot=1;
tree.build(1,1,m);

for(int i=1;i<=n;i++){
scanf("%d%d",&t2,&t3);
if(true){
printf("%d ",tree.search(1,t2,t3));										
}
else{
tree.change(1,t2,t3);		
}
}

fclose(stdin);
fclose(stdout);
return 0;				
}


